[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
modf() Split Floating Point into Integer Part and Fraction
#include <math.h>
double modf(x,intptr);
double x; Floating-point value
double *intptr; Pointer to stored integer portion
modf() separates 'x' into fractional and integer parts. 'intptr' is
set to the integer portion, and the fractional portion is returned.
Returns: The fractional part of 'x'. There is no error
return.
-------------------------------- Example ---------------------------------
The following statements get the fractional and integer parts of two
different floating-point values:
#include <math.h> /* For function decl. only */
main()
{
double f, i;
f = modf(69.2665, &i); /* f = 0.2665, i = 69.0 */
f = modf(-69.2665, &i); /* f = -0.2665, i = -69.0 */
}
See Also:
fmod()
frexp()
ldexp()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson